package com.sunzm.demodbencrypted.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.sunzm.demodbencrypted.entity.User;
import com.sunzm.demodbencrypted.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@Slf4j
public class UserService {
    @Resource
    private UserMapper userMapper;

    public boolean save(User user) {
        int insert = userMapper.insert(user);
        return insert > 0;
    }

    public User getById(Long id) {
        return userMapper.selectById(id);
    }

    public List<User> getAll() {
        return userMapper.selectList(null);
    }
}
